﻿namespace AspDotNet.Core7.First.Middlewares
{
    public class ResponseEditingMiddleware : BaseMiddleware
    {
        public ResponseEditingMiddleware(RequestDelegate nextMiddleware)
            : base(nextMiddleware)
        {
        }

        public override async Task Invoke(HttpContext httpContext)
        {
            await NextMiddleware.Invoke(httpContext);
            if (httpContext.Response.StatusCode == 401)
            {
                await httpContext.Response.WriteAsync("Firefox browser not authorized");
            }
            else if (httpContext.Response.StatusCode == 404)
            {
                await httpContext.Response.WriteAsync("No Response Generated");
            }
        }
    }
}
